﻿using AppService.IService.System_operation;
using AppService.IService.System_order;
using AppService.Service.System_operation;
using AppService.Service.System_order;
using Domain.Entity.System_operation;
using Domain.Entity.System_Ordermanagement;
using Microsoft.AspNetCore.Mvc;

namespace WebAPI.Controllers.System_operation
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class Bill_olController:ControllerBase
    {
        private readonly IBill_olService Ibill_olService;

        public Bill_olController(IBill_olService ibill_olService)
        {
            Ibill_olService = ibill_olService;
        }

        /// <summary>
        /// 查询提货单的数据总数
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public int Count()
        {
            return Ibill_olService.Count();
        }
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="currentPage"></param>
        /// <param name="PageSize"></param>
        /// <returns></returns>
        [HttpGet]
        public List<Bill_ol> GetBill_ols(int currentPage, int PageSize)
        {
            List<Bill_ol> bill_Ols = Ibill_olService.GetBill_ols(currentPage, PageSize);
            return bill_Ols;
        }

        /// <summary>
        /// 逻辑删除
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        [HttpDelete]
        public bool DelBill(int id)
        {
            return Ibill_olService.DelBill(id);
        }

        /// <summary>
        /// 条件查询
        /// </summary>
        /// <param name="Origin_place"></param>
        /// <param name="Det_place"></param>
        /// <param name="Pickup_endtime"></param>
        /// <returns></returns>
        [HttpGet]
        public List<Bill_ol> GetBill_condition(string? Origin_place, string? Det_place, string? Pickup_endtime, int currentPage, int PageSize)
        {
            //return iorderService.GetOrders_condition(Ord_type, Ord_startaddress, Ord_destination, Client_name,Ord_time);
            List<Bill_ol> bill = Ibill_olService.Bill_condition(Origin_place, Det_place,  Pickup_endtime,  currentPage,  PageSize);
            return bill;
        }

        /// <summary>
        /// 根据提货单ID查询提货单基础信息
        /// </summary>
        /// <param name="Billol_Id"></param>
        /// <returns></returns>
        [HttpGet]
        public List<Bill_ol> GetBill_XQ(int Billol_Id)
        {
            return Ibill_olService.GetBill_XQ(Billol_Id);
        }

        /// <summary>
        /// 查询提货单的货物
        /// </summary>
        /// <returns></returns>
        [HttpGet]
        public List<Orders> GetBill_Order(string Order_Id)
        {
            return Ibill_olService.GetBill_Order(Order_Id);
        }

        /// <summary>
        /// 修改提货状态
        /// </summary>
        /// <returns></returns>

        [HttpPut("{string Ord_Id}")]
        public bool THZT(string Ord_Id)
        {
            return Ibill_olService.THZT(Ord_Id);
        }
    }
}
